/*
  DigitalReadSerial
 Reads a digital input on pin 2, prints the result to the serial monitor 
 
 This example code is in the public domain.
 */

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 9;

// the setup routine runs once when you press reset:
void setup() {
  pinMode(8,OUTPUT);
  pinMode(pushButton,INPUT);
 
  // initialize serial communication at 9600 bits per second:
  Serial3.begin(9600);
  // make the pushbutton's pin an input:
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  // print out the state of the button:
  if (LOW == digitalRead(pushButton))
  {
    delay(50);
        if (LOW == digitalRead(pushButton))
        {
            digitalWrite(8,HIGH);
            while(1)
            {
                if (HIGH == digitalRead(pushButton))
                {
                    delay(50);
                    if (HIGH == digitalRead(pushButton))
                    {
                        if (HIGH == digitalRead(pushButton))
                        break;
                    }

                }
            }
            digitalWrite(8,LOW);
        }

  }


  Serial3.print("play,001,$");
  delay(100000);        // delay in between reads for stability
}



